package com.xcity.game.npc;

import java.text.MessageFormat;

import com.xcity.game.skill.Skill;
import com.xcity.game.skill.template.SkillTemplate;

public class NpcSkill implements Skill {
	
	private SkillTemplate template;
	
	protected NpcSkill(SkillTemplate template) {
		this.template = template;
	}

	@Override
	public int getId() {
		return template.getId();
	}

	@Override
	public String getName() {
		return template.getName();
	}

	@Override
	public String getIcon() {
		return template.getIcon();
	}

	@Override
	public String getDesc() {
		String desc = template.getDesc();
		Object[] vals = template.getValues(1);
		if (vals != null && vals.length > 0) {
			desc = MessageFormat.format(desc, vals);
		}
		return desc;
	}

	@Override
	public SkillTemplate getTemplate() {
		return template;
	}

	@Override
	public boolean addLevel(int val, String cause) {
		return false;
	}

	@Override
	public float getParameter(int index) {
		return template.getValue(index, 1);
	}
	
}
